/*
 * @Author: your name
 * @Date: 2021-06-12 12:36:20
 * @LastEditTime: 2021-06-16 12:57:48
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \UDP\SERVER_\log.cpp
 */
#include "log.h"


Log::Log()
{
    //追加写入文件
    this->out_log.open(LOG_NAME,ios::out | ios::app);
    this->out_log << "-------------start-------------" << endl;
    //调用日志函数先写入当前时间

    // 基于当前系统的当前日期/时间
    time_t now = time(0);
   
    // 把 now 转换为字符串形式
    char* dt = ctime(&now);
    this->out_log << "当前时间:" << dt;
}

Log::~Log()
{
    //关闭文件
    this->out_log << "-------------end-------------" << endl << endl;
    this->out_log.close();
}

ofstream& Log::get_Log_Ptr()
{
    return this->out_log;
}